﻿using System;
using System.ServiceProcess;
using Common;

namespace ZgOffice.SvrMangr
{
    public partial class SetUserControl : DevExpress.XtraEditors.XtraUserControl
    {
        WinServiceHelper wsh;
        public SetUserControl()
        {
            InitializeComponent();
            wsh = new WinServiceHelper("ZGOfficeService");
        }
        
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            wsh.Install("ZgOffice.WindowsServiceHost.exe");
        }

        private void delSerBtn_Click(object sender, EventArgs e)
        {
            ServiceController serviceController = new ServiceController("ZGOfficeService");
            if (serviceController.CanStop)
            {
                serviceController.Stop();
            }
            wsh.Uninstall("ZgOffice.WindowsServiceHost.exe");
        }
    }
}
